package com.yiren.backstage.db.dao.bean;

import com.yiren.backstage.currency.entity.GradeStandardEntity;
import com.yiren.backstage.currency.entity.LightCombinationEntity;
import com.yiren.backstage.currency.entity.SingleLightEntity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Time:2022/5/26 8:29
 * Author:xiaozan
 * Description:oss 评判规则、配置数据同步bean
 */
public class SynExamBean {
    /**
     * 数据调整场景对应解决方案
     * 1：当官方模板删除评判时：用户修改了当前删除评判，
     * 2：当官方模板更改逻辑后（监控运算、扣分标准）：将当前评判改成用户私有数据失效状态（更新时告知用户那条评判之前修改已经无效）
     * 3：当官方模板修改评判启用状态时：1：官方模板后续不能修改启用状态 2：当修改了启用状态客户不能修改问题
     * 4：当用户修改的 ID 针对数据库不存在时：
     */

    /**
     * 考场相关配置
     * 练车设置
     * 语音播报设置
     * 灯光参数
     * 上车准备
     * 加减档
     */
    private Map<String, Object> examConfigMap;

    /**
     * 修改值类型
     * 1：评判启用状态 记录启用还是不启用
     * 2：任务详情 条件值
     * 3：任务详情 条件要素
     * 4：任务详情 执行值
     * 5：任务详情 执行要素
     */
    private List<Parameter> parameters;

    /*** 单项灯光 */
    private Map<String, ObjectClass<SingleLightEntity>> singleLightMap;

    /*** 组合灯光 */
    private Map<String, ObjectClass<LightCombinationEntity>> combinationLightMap;

    /*** 扣分标准 */
    private Map<String, ObjectClass<GradeStandardEntity>> gradeStandardMap;

    /*** 监控运算参数修改值 */
    private List<Parameter> monitorCounts;

    /***
     * 泛型同步对象
     * @param <T>
     */
    public static class ObjectClass<T> {

        public ObjectClass(T dataObject, int state) {
            this.dataObject = dataObject;
            this.state = state;
        }

        /*** 数据对象 */
        T dataObject;

        /**
         * 数据操作类型
         * 1：新增
         * 2：修改
         * 3：删除
         */
        int state;

        public T getDataObject() {
            return dataObject;
        }

        public void setDataObject(T dataObject) {
            this.dataObject = dataObject;
        }

        public int getState() {
            return state;
        }

        public void setState(int state) {
            this.state = state;
        }
    }

    /**
     * 项目规则参数同步内部类
     */
    public static class Parameter {

        /*** 修改值类型 */
        private int type;

        /*** 修改值 ID */
        private String id;

        /*** 参数值 */
        private Object value;

        public Parameter(String id, Object value) {
            this.id = id;
            this.value = value;
        }

        public Parameter(int type, String id, Object value) {
            this.type = type;
            this.id = id;
            this.value = value;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public Object getValue() {
            return value;
        }

        public void setValue(Object value) {
            this.value = value;
        }
    }

    public List<Parameter> getParameters() {
        if (null == parameters) parameters = new ArrayList<>();
        return parameters;
    }

    public void setParameters(List<Parameter> parameters) {
        this.parameters = parameters;
    }

    public Map<String, Object> getExamConfigMap() {
        if (null == examConfigMap) examConfigMap = new HashMap<>();
        return examConfigMap;
    }

    public void setExamConfigMap(Map<String, Object> examConfigMap) {
        this.examConfigMap = examConfigMap;
    }

    public Map<String, ObjectClass<SingleLightEntity>> getSingleLightMap() {
        return singleLightMap;
    }

    public void setSingleLightMap(Map<String, ObjectClass<SingleLightEntity>> singleLightMap) {
        this.singleLightMap = singleLightMap;
    }

    public Map<String, ObjectClass<LightCombinationEntity>> getCombinationLightMap() {
        return combinationLightMap;
    }

    public void setCombinationLightMap(Map<String, ObjectClass<LightCombinationEntity>> combinationLightMap) {
        this.combinationLightMap = combinationLightMap;
    }

    public Map<String, ObjectClass<GradeStandardEntity>> getGradeStandardMap() {
        return gradeStandardMap;
    }

    public void setGradeStandardMap(Map<String, ObjectClass<GradeStandardEntity>> gradeStandardMap) {
        this.gradeStandardMap = gradeStandardMap;
    }

    public List<Parameter> getMonitorCounts() {
        if (null == monitorCounts) monitorCounts = new ArrayList<>();
        return monitorCounts;
    }

    public void setMonitorCounts(List<Parameter> monitorCounts) {
        this.monitorCounts = monitorCounts;
    }
}
